<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <form action="">
        <input type="text" name="username" autocomplete="off">
        <br>
        <input type="password" name="password" id="">
        <br>
        <input type="text" name="phone">
        <input type="submit" value="提交">
    </form>

    <script>

        // var str = 'file:///C:/Users/admin/Desktop/wh2201二阶段/day09/课堂代码/14split练习.html?username=yy&password=666&phone=1888888888' ;
        var str = 'https://www.baidu.com/s?wd_spt=1&rsv_iqid=0xac510d6d00039771&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_e=%E5%8D%83%E9%94%8B&rsvnter=1&rsv_dl=tb&rsv_sug3=9&rsv_sug1=2&rsv_sug7=100&rsv_sug2=0&rsv_btype=i&inputT=2700&rsv_sug4=2700' ;

        // [
        //     ['username' , 'yy'] ,
        //     ['password' , '666'],
        //     ['phone' , '18888888']
        // ]

        var arr = str.split('?') ;
        console.log(arr) ;

        // 后面想要的字符串
        var res = arr[1] ;
        console.log(res) ;  // username=yy&password=666

        var arr2 = res.split('&') ;
        console.log(arr2) ;   // ['username=yy', 'password=666']


        var resArr = [] ;
        for(var i = 0 ; i < arr2.length ; i++) {
            var arr3 = arr2[i].split('=') ;
            resArr.push(arr3) ;
        }
        console.log(resArr)



    </script>
    
</body>
</html>